<%@page import="entity.Member"%>
<%@page import="dao.MemberDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page errorPage="error.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" charset="utf-8" />
        <style>
            h1,p,h3{
                font-family: STKaiti;
                font-weight: bold
                }
                #chongzhi{
                    float: left;
                    margin-top: 110px;
                    border: cornsilk 1px solid;
                    background-color: aliceblue; 
                    width: 25%; 
                    margin-left: 1050px; 
                    height: 400px;
                    border-radius: 20px;
                    box-shadow: 5px 5px 5px grey
                }
                a{
                    text-decoration:none;  
                }
                div{border-radius: 10px; }
        </style>
    </head>
    <body style=" background-color: whitesmoke"><div>
        <div><a href="index"><h1 style="font-size:70px; float: left">在线书店</h1></a></div><div style="float: right"><img src="img/充值2.jpg" width="150px" height="150px"></div>
        <div style=" float: left; border:  1px black solid; margin-top:0px; height: 700px; background-image: url(img/充值1.jpg);  height: 600px;  width: 1660px;">
        <div  id="chongzhi"> 
                <%
                    String name=(String)session.getAttribute("username");
                    Member member=new MemberDao().getMemberByName(name);
                %>
                <h1 style="margin-left:100px; font-size: 40px;">账户充值&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="Member.jsp?name=<%=name%>">返回</a></h1><br>
                <p style=" text-align: center;color: salmon; font-size: 40px;">余额：<%=member.getMoney()%></p>
                <h2 style=" text-align: center">充值金额：</h2>
                
                    
                    <form name="ff"   action="amos" onsubmit="return check()">
            <div class="col-lg-6">
                <div class="input-group" style="width:200px; margin-left:90px;">
                    <input type="text" class="form-control" name="addmoney" style="width:200px; height:40px; font-size: 20px;"     >
                    <br><br><br>
                   
                    <button style=" margin-left: 60px;width: 70px; height: 40px; font-size:15px;" class="btn btn-success">充值</button>
                   
                </div>
            </div>
        </form>
                    
                
        </div></div>
        
        
        
        </div>
                
                <script type="text/javascript">
            function check(){
                var patrn = /^(-)?\d+(\.\d+)?$/;               
                if(document.ff.addmoney.value===""){
                    alert("请输入充值金额！");
                    return false;
                }if((patrn.exec(document.ff.addmoney.value) === null)||(document.ff.addmoney.value<=0)){
                    alert("请输入有效金额！");
                    return false;
                }               
                return true;
            
            }
        </script>
                
    </body>
</html>
